package ru.inse.core.service.realty.filter;

import ru.inse.core.dao.realty.RealtyQueryParam;


public class RoomFilter
    implements IRealtyFilter
{
    public static final RoomFilter ONE = new RoomFilter("realty.filter.roomcount.one", 1, 1);
    public static final RoomFilter TWO = new RoomFilter("realty.filter.roomcount.two", 2, 2);
    public static final RoomFilter THREE = new RoomFilter("realty.filter.roomcount.three", 3, 3);
    public static final RoomFilter FOUR = new RoomFilter("realty.filter.roomcount.four", 4, 4);
    public static final RoomFilter FIVE_AND_MORE = new RoomFilter("realty.filter.roomcount.fiveAndMore", 5, null);
    
    private String labelId;
    private Integer hiRoomCount;
    private Integer loRoomCount;

    private RoomFilter(String labelId, Integer loRoomCount, Integer hiRoomCount)
    {
        this.labelId = labelId;
        this.loRoomCount = loRoomCount;
        this.hiRoomCount = hiRoomCount;
    }

    public RealtyQueryParam makeParam(RealtyQueryParam copyFromParam)
    {
        RealtyQueryParam newParam = new RealtyQueryParam();
        newParam.copyFrom(copyFromParam.getParamMap());
        if (hiRoomCount != null)
        {
            newParam.setHiI1(hiRoomCount);
        }
        if (loRoomCount != null)
        {
            newParam.setLoI1(loRoomCount);
        }
        return newParam;
    }

    public String getLabelId()
    {
        return this.labelId;
    }
}
